package model;

import java.io.Serializable;


public abstract class Transaction implements Serializable {
	
	private static final long serialVersionUID = -8346174515434206647L;
	
	private double amount;
	private int account;
	
	private int year;
	private int month;
	private int day;
	
	private String venue;
	
	
	public Transaction(double amount, int account, String venue, int year, int month, int day) {
		this.amount = amount;
		this.account = account;
		this.venue = venue;
		this.year = year;
		this.month = month;
		this.day = day;
	}
	
	public double getAmount() {
		return amount;
	}

	public void setAmount(double amount) {
		this.amount = amount;
	}	
	
	public int getAccount() {
		return account;
	}
	
	public void setAccount(int account) {
		this.account = account;
	}

	public String getVenue() {
		return venue;
	}
	
	public void setVenue(String venue) {
		this.venue = venue;
	}
	
	public int getYear() {
		return year;
	}
	
	public int getMonth() {
		return month;
	}
	
	public int getDay() {
		return day;
	}

	public boolean matchesDay(int year, int month, int day) {
		return (matchesMonth(year, month) && getDay() == day);
	}

	public boolean matchesMonth(int year, int month) {
		return (matchesYear(year) && getMonth() == month);
	}
	
	public boolean matchesYear(int year) {
		return (getYear() == year);
	}
	
	public boolean matchesAccount(Integer rqAccount) {
		if(rqAccount == null || rqAccount == -1) return true;
		else return (rqAccount.equals(account));		
	}
}
